package com.aiyige.page.publish.learnvideo;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.aiyige.R;
import com.aiyige.utils.widget.BaseBottomDialogFragment;

import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

/**
 * Created by zhuyakun on 2017/11/6.
 */

public class EditPublishLearnVideoItemBottomDialog extends BaseBottomDialogFragment {

    Unbinder unbinder;
    int position;
    Listener listener;

    public Listener getListener() {
        return listener;
    }

    public void setListener(Listener listener) {
        this.listener = listener;
    }

    public static EditPublishLearnVideoItemBottomDialog newInstance() {
        return new EditPublishLearnVideoItemBottomDialog();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.edit_publish_learn_video_item_bottom_dialog, container, false);
        unbinder = ButterKnife.bind(this, view);
        return view;
    }


    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    @OnClick({R.id.deleteBtn})
    public void onViewClicked(View view) {
        dismiss();
        if (listener == null) return;
        switch (view.getId()) {
            case R.id.deleteBtn:
                listener.onDelete(position);
                break;
        }
    }

    public int getPosition() {
        return position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    public interface Listener {
        void onDelete(int position);
    }


}
